package com.wteam.dragon.system.apps.server.povo.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.wteam.dragon.system.basebean.bean.BaseBean;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;

/**
 * 七牛云对象存储配置类
 * @author Zheng Jie
 * @date 2018-12-31
 */
@Data
@Table
@TableName
@EqualsAndHashCode(callSuper = true)
public class QiniuConfig extends BaseBean {
    @IsKey
    @IsNotNull
    @IsAutoIncrement
    @TableId(type = IdType.AUTO)
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "自增id")
    private Long id;

    @NotBlank
    @IsNotNull
    @ColumnType(MySqlTypeConstant.TEXT)
    @Column(comment = "一个账号最多拥有两对密钥(Access/Secret Key)")
    private String accessKey;

    @NotBlank
    @IsNotNull
    @ColumnType(MySqlTypeConstant.TEXT)
    @Column(comment = "一个账号最多拥有两对密钥(Access/Secret Key)")
    private String secretKey;

    @NotBlank
    @IsNotNull
    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "存储空间名称作为唯一的 Bucket 识别符")
    private String bucket;

    /**
     * Zone表示与机房的对应关系
     * 华东	Zone.zone0()
     * 华北	Zone.zone1()
     * 华南	Zone.zone2()
     * 北美	Zone.zoneNa0()
     * 东南亚 Zone.zoneAs0()
     */
    @NotBlank
    @IsNotNull
    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "与机房的对应关系")
    private String zone;

    /** 外链域名，可自定义，需在七牛云绑定 */
    @NotBlank
    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "外链域名")
    private String host;

    /** 空间类型：公开/私有 */
    @IsNotNull
    @DefaultValue("公开")
    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "与机房的对应关系，例如：华东 Zone.zone0()")
    private String type;
}
